<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('学员成绩')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="col-sm-12 search-collapse">
        <form id="data-form" autocomplete="off">
            <div class="select-list">
                <ul>
                    <li>
                        </label>老师姓名：</label>
                        <input type="text" name="teacherName" />
                    </li>
                    <li>
                        </label>学员姓名：</label>
                        <input type="text" name="childName"/>
                    </li>
                    <li>
                        </label>电话：</label>
                        <input type="text" name="phone"/>
                    </li>
                    <li>
                        <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                        <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                    </li>
                </ul>
            </div>
        </form>
    </div>
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    // 权限
    // 字典
    var prefix = ctx + "business/courseChildScore";

    $(function () {
        var options = {
            url: prefix + "/listAllChild",
            queryParams: queryParams,
            modalName: "数据",
            columns: [
                {
                    field: 'childId',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'childName',
                    title: '姓名',
                },
                {
                    field: 'phone',
                    title: '联系电话',
                },

                {
                    field: 'age',
                    title: '年龄'
                },
                {
                    field: 'grade',
                    title: '年级',
                    formatter: function (value, row, index) {
                        var action='';
                        if(value==0){action="学前"};
                        if(value==1){action="一年级"};
                        if(value==2){action="二年级"};
                        if(value==3){action="三年级"};
                        if(value==4){action="四年级"};
                        if(value==5){action="五年级"};
                        if(value==6){action="六年级"};
                        if(value==7){action="七年级"};
                        if(value==8){action="八年级"};
                        if(value==9){action="九年级"};
                        return action;
                    }
                },
                {
                    field: 'completeClassTimes',
                    title: '已上课时数'
                },
                {
                    title: '操作',
                    align: 'left',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs " href="javascript:void(0)" onclick="scoreDetail(\'' + row.childId + '\',\'' + row.childName + '\',\'' + row.age + '\',\'' + row.grade + '\')"><i class="fa fa-search"></i>查看成绩</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function scoreDetail(childId,childName,age,grade) {
        var url = prefix + "/childScoreDetail/" +childId+"/"+childName+"/"+age+"/"+grade;
        $.modal.openTab("成绩记录", url);
    }

    function queryParams(params) {
        var search = $.table.queryParams(params);
        var selectIndex = window.parent.document.getElementById('parentSchoolList').selectedIndex;
        if (selectIndex >= 0) {
            var centerId = window.parent.document.getElementById('parentSchoolList').options[selectIndex].value;
            search.centerId = centerId;
        }
        var scheduleTime = $('#scheduleTime').val();
        var teacherName = $('#teacherName').val();
        var teacherId = $('#teacherId').val();
        search.scheduleTime = scheduleTime;
        // search.teacherName = teacherName;
        search.teacherId = teacherId;
        return search;
    }


</script>
</body>

</html>